package com.zigong.app.ui.dialog;

import android.app.Dialog;
import android.os.Bundle;
import android.os.Message;
import android.view.View;

import com.ruihang.generalibrary.ui.dialog.BaseDialogFragment;
import com.ruihang.generalibrary.ui.widget.CustomFontTextView;
import com.zigong.app.R;

/**
 * Created by Administrator on 2017/6/23 0023.
 */

public class ConfirmFragment extends BaseDialogFragment implements View.OnClickListener {
    private CustomFontTextView cancel_cv, sure_cv;
    private int position = 0;

    public int getPosition() {
        return position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    @Override
    protected int getContentRes() {
        return R.layout.confirm_fragment;
    }

    @Override
    protected void initViews(Dialog dialog, Bundle savedInstanceState) {
        cancel_cv = (CustomFontTextView) dialog.findViewById(R.id.dia_show_cancel);
        sure_cv = (CustomFontTextView) dialog.findViewById(R.id.dia_show_sure);
        cancel_cv.setOnClickListener(this);
        sure_cv.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        if (v == cancel_cv) {
            dismissAllowingStateLoss();
        } else if (v == sure_cv) {
            if (callBack != null) {
                Message message = new Message();
                message.what = position;
                callBack.onCallBackMsg(this, message);
                dismissAllowingStateLoss();
            }
        }
    }


}
